package com.ning.city.dto;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * @author Ning 242741154@qq.com
 * @date 2021/1/5 10:12
 */
public interface UserDto {
    @Data
    class Register {
        @NotNull(message = "用户名不能为空")
        @Length(min = 3, max = 20, message = "长度有误")
        private String name;
        @NotNull(message = "密码不能为空")
        @Length(min = 32, max = 32, message = "密码长度有误")
        private String password;
    }

    @Data
    class Login {
        @NotNull(message = "账号不能为空")
        private Integer id;
        @NotNull(message = "密码不能为空")
        @Length(min = 32, max = 32, message = "密码长度有误")
        private String password;
    }

    @Data
    class PageInfo implements ThePageInfo {
        //        @NotNull(message = "页号不能为空")
        @Min(value = 1, message = "页号不能为空")
        private Integer pageNum = 1;
        //        @NotNull(message = "页面大小不能为空")
        @Min(value = 5, message = "页面大小不能小于 5")
        @Max(value = 20, message = "页面大小不能大于 20")
        private Integer pageSize = 10;
        private Integer UserType;
//        private String keyword;
    }

    @Data
    class UpdatePassword {
        @NotNull(message = "账号不能为空")
        private String userId;
        @NotNull(message = "旧密码不能为空")
        private String oldPassword;
        @NotNull(message = "新密码不能为空")
        private String newPassword;
    }

    @Data
    class UpdateName {
        @NotNull(message = "账号不能为空")
        private String userId;
        @NotNull(message = "用户名不能为空")
        @Length(min = 3, max = 20, message = "长度有误")
        private String newName;
    }
}
